"""
@Time    : 2025/7/23 11:40
@Author  : white.tie
@File    : TrustedHostMiddleware.py
@Desc    : 
"""
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.trustedhost import TrustedHostMiddleware

app = FastAPI()

app.add_middleware(
    TrustedHostMiddleware, allowed_hosts=["127.0.0.1", "localhost"]
)


@app.get("/")
async def main():
    return {"message": "Hello World"}

if __name__ == '__main__':
    uvicorn.run(app,host="0.0.0.0",port=8050)